<?php
/**
 * Formulário padrão
 */
class App_Form_Categoria extends Voitech_Form
{
	public function __construct($options=array())
	{
		parent::__construct($options);
		
		$this->setAttribs(array('name'=>'frmCadastroCategoria', 'id'=>'frmCadastroCategoria', 'class'=>'form last-child'));
		
		// add id element
        $this->addElement('hidden', 'co_categoria');
        
        // remove id's decorators
        $this->getElement('co_categoria')
            ->removeDecorator('DtDdWrapper')
            ->removeDecorator('HtmlTag')
            ->removeDecorator('Label');
		
		$noCategoria 	= new Zend_Form_Element_Text( 'no_categoria' );
		$noCategoria->setLabel( 'Categoria:' )
				 ->setAttribs( array('size'=>'55') )
		         ->addFilter( new Zend_Filter_StringTrim() )
				 ->addValidator( new Zend_Validate_StringLength( array( 'min'=>'3', 'max'=>'255' ) ) )
		         ->setDecorators( $this->_decoratorDefault )
				 ->setRequired( true );
		$this->addElement( $noCategoria );				
                
                $buttonCancelar = new Zend_Form_Element_Button('Cancelar');
		$buttonCancelar->setAttribs( array('class'=> 'first-child last-child','style'=>'float:left;margin-top: 17px', 'id' => 'btnCancelar' ) )
		           ->removeDecorator( 'label' );
		$this->addElement( $buttonCancelar );		

		$buttonCdst = new Zend_Form_Element_Button('Salvar');
		$buttonCdst->setAttribs( array('class'=> 'first-child last-child','style'=>'float:right; margin-top: 17px', 'id' => 'btnSalvar' ) )
		           ->setDecorators( $this->_decoratorDefault )
		           ->removeDecorator( 'label' );
                $this->addElement( $buttonCdst );
                
                
		
		$this->addDisplayGroup(array('no_categoria','ds_endereco','nu_telefone','Cancelar','Salvar'),'Cadastro',array('legend' => 'Formulario de cadastro de categoria', 'class'=>'grey-bg first-child last-child fieldset-with-legend fieldset-with-legend-first-child'));
	}
}